import { useEditorStore } from '@/store/useEditorZustand';
import { Button } from 'antd';
import { Redo2Icon, Undo2Icon } from 'lucide-react';

const HisotryButton = () => {
  const { editor } = useEditorStore();

  return (
    <>
      <Button
        type="text"
        icon={<Undo2Icon className="size-4" />}
        onClick={() => editor.chain().focus().undo().run()}
        disabled={!editor?.can().undo()}
      />
      <Button
        type="text"
        icon={<Redo2Icon className="size-4" />}
        onClick={() => editor.chain().focus().redo().run()}
        disabled={!editor?.can().redo()}
      />
    </>
  );
};

export default HisotryButton;
